package com.vodafone.nowplus.android.peoplemail.helper;

import java.util.HashMap;
import java.util.Map;

import android.util.Log;

public class Profiling {
	
	private static final boolean active = false;
	
	private static Map<String,Long> calls = new HashMap<String,Long>();
	
	public static void call(String function) {
		if(!active) {
			return;
		}
		
		calls.put(function, new Long(System.currentTimeMillis()));
	}
	
	public static void finish(String function) {
		if(!active) {
			return;
		}

		long until = System.currentTimeMillis();
		Long started = calls.get(function);
		if(started!=null) {
			Log.d("pamc-profiling", function + ": " + Long.toString(until-started.longValue())+ "ms");
			calls.remove(function);
		}
	}

}
